import dayjs from 'dayjs'

export const userColumns = [
  { title: '用户名', dataIndex: 'username', width: '160px', key: 'username' },
  { title: '邮箱', dataIndex: 'email', width: '160px' },
  { title: '手机号', dataIndex: 'telephone', width: '160px' },
  {
    title: '注销',
    dataIndex: 'isCancel',
    width: '120px',
    customRender: ({ text }: any) => {
      return text ? '是' : '否'
    },
  },
  { title: '冻结', dataIndex: 'isFrozen', width: '120px', key: 'isFrozen' },
  { title: '角色', dataIndex: 'roles', width: '200px', key: 'userRoles' },
  { title: '权限', dataIndex: 'permissions', width: '200px', key: 'permissions' },
  {
    title: '创建日期',
    dataIndex: 'createAt',
    width: '200px',
    customRender: ({ text }: any) => {
      return dayjs(text).format('YYYY-MM-DD HH:mm:ss')
    },
  },
  {
    title: '更新日期',
    dataIndex: 'updateAt',
    width: '200px',
    customRender: ({ text }: any) => {
      return dayjs(text).format('YYYY-MM-DD HH:mm:ss')
    },
  },
]

export const roleColumns = [
  { title: '名称', dataIndex: 'name', width: '300px',key: 'name' },
  { title: '权限', dataIndex: 'permissions', width: '400px',key: 'permissions' },
  { title: '操作', key: 'operation' },
]

export const permissionColumns = [
  { title: 'code', dataIndex: 'code', width: '300px',key: 'code'  },
  { title: '说明', dataIndex: 'description', width: '400px' },
  { title: '操作', key: 'operation' },
]
